namespace ContactsSync.Infrastructure.Models
{
    using System.ComponentModel;
    using System.Globalization;

    public class Contact : INotifyPropertyChanged
    {
        private object imageSource;

        public event PropertyChangedEventHandler PropertyChanged;

        public string Id { get; set; } 
        
        public string FirstName { get; set; } 
        
        public string LastName { get; set; }

        public object ImageSource
        {
            get
            {
                return this.imageSource;
            }

            set
            {
                this.imageSource = value;

                this.OnPropertyChanged("ImageSource");
            }
        }

        public override string ToString()
        {
            return string.Format(CultureInfo.InvariantCulture, "{0} {1}", this.FirstName, this.LastName);
        }

        private void OnPropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler changed = this.PropertyChanged;
            if (changed != null)
            {
                changed(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}